/*
 * XML Type:  unique-constraint
 * Namespace: http://java.sun.com/xml/ns/persistence/orm
 * Java type: com.googlecode.horncomb.orm.jpa.v10.xmlbeans.UniqueConstraint
 *
 * Automatically generated - do not modify.
 */
package com.googlecode.horncomb.orm.jpa.v10.xmlbeans.impl;
/**
 * An XML unique-constraint(@http://java.sun.com/xml/ns/persistence/orm).
 *
 * This is a complex type.
 */
@SuppressWarnings("unchecked")
public class UniqueConstraintImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements com.googlecode.horncomb.orm.jpa.v10.xmlbeans.UniqueConstraint
{

    /**  */
	private static final long serialVersionUID = 1312638575780535090L;


	public UniqueConstraintImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }

    private static final javax.xml.namespace.QName COLUMNNAME$0 =
        new javax.xml.namespace.QName("http://java.sun.com/xml/ns/persistence/orm", "column-name");


    /**
     * Gets a List of "column-name" elements
     */
    public java.util.List<java.lang.String> getColumnNameList()
    {
        final class ColumnNameList extends java.util.AbstractList<java.lang.String>
        {
            @Override
			public java.lang.String get(int i)
                { return UniqueConstraintImpl.this.getColumnNameArray(i); }

            @Override
			public java.lang.String set(int i, java.lang.String o)
            {
                java.lang.String old = UniqueConstraintImpl.this.getColumnNameArray(i);
                UniqueConstraintImpl.this.setColumnNameArray(i, o);
                return old;
            }

            @Override
			public void add(int i, java.lang.String o)
                { UniqueConstraintImpl.this.insertColumnName(i, o); }

            @Override
			public java.lang.String remove(int i)
            {
                java.lang.String old = UniqueConstraintImpl.this.getColumnNameArray(i);
                UniqueConstraintImpl.this.removeColumnName(i);
                return old;
            }

            @Override
			public int size()
                { return UniqueConstraintImpl.this.sizeOfColumnNameArray(); }

        }

        synchronized (monitor())
        {
            check_orphaned();
            return new ColumnNameList();
        }
    }

    /**
     * Gets array of all "column-name" elements
     */
    public java.lang.String[] getColumnNameArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(COLUMNNAME$0, targetList);
            java.lang.String[] result = new java.lang.String[targetList.size()];
            for (int i = 0, len = targetList.size() ; i < len ; i++)
                result[i] = ((org.apache.xmlbeans.SimpleValue)targetList.get(i)).getStringValue();
            return result;
        }
    }

    /**
     * Gets ith "column-name" element
     */
    public java.lang.String getColumnNameArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(COLUMNNAME$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target.getStringValue();
        }
    }

    /**
     * Gets (as xml) a List of "column-name" elements
     */
    public java.util.List<org.apache.xmlbeans.XmlString> xgetColumnNameList()
    {
        final class ColumnNameList extends java.util.AbstractList<org.apache.xmlbeans.XmlString>
        {
            @Override
			public org.apache.xmlbeans.XmlString get(int i)
                { return UniqueConstraintImpl.this.xgetColumnNameArray(i); }

            @Override
			public org.apache.xmlbeans.XmlString set(int i, org.apache.xmlbeans.XmlString o)
            {
                org.apache.xmlbeans.XmlString old = UniqueConstraintImpl.this.xgetColumnNameArray(i);
                UniqueConstraintImpl.this.xsetColumnNameArray(i, o);
                return old;
            }

            @Override
			public void add(int i, org.apache.xmlbeans.XmlString o)
                { UniqueConstraintImpl.this.insertNewColumnName(i).set(o); }

            @Override
			public org.apache.xmlbeans.XmlString remove(int i)
            {
                org.apache.xmlbeans.XmlString old = UniqueConstraintImpl.this.xgetColumnNameArray(i);
                UniqueConstraintImpl.this.removeColumnName(i);
                return old;
            }

            @Override
			public int size()
                { return UniqueConstraintImpl.this.sizeOfColumnNameArray(); }

        }

        synchronized (monitor())
        {
            check_orphaned();
            return new ColumnNameList();
        }
    }

    /**
     * Gets (as xml) array of all "column-name" elements
     */
    public org.apache.xmlbeans.XmlString[] xgetColumnNameArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(COLUMNNAME$0, targetList);
            org.apache.xmlbeans.XmlString[] result = new org.apache.xmlbeans.XmlString[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }

    /**
     * Gets (as xml) ith "column-name" element
     */
    public org.apache.xmlbeans.XmlString xgetColumnNameArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().find_element_user(COLUMNNAME$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }

    /**
     * Returns number of "column-name" element
     */
    public int sizeOfColumnNameArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(COLUMNNAME$0);
        }
    }

    /**
     * Sets array of all "column-name" element
     */
    public void setColumnNameArray(java.lang.String[] columnNameArray)
    {
        synchronized (monitor())
        {
            check_orphaned();
            arraySetterHelper(columnNameArray, COLUMNNAME$0);
        }
    }

    /**
     * Sets ith "column-name" element
     */
    public void setColumnNameArray(int i, java.lang.String columnName)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(COLUMNNAME$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.setStringValue(columnName);
        }
    }

    /**
     * Sets (as xml) array of all "column-name" element
     */
    public void xsetColumnNameArray(org.apache.xmlbeans.XmlString[]columnNameArray)
    {
        synchronized (monitor())
        {
            check_orphaned();
            arraySetterHelper(columnNameArray, COLUMNNAME$0);
        }
    }

    /**
     * Sets (as xml) ith "column-name" element
     */
    public void xsetColumnNameArray(int i, org.apache.xmlbeans.XmlString columnName)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().find_element_user(COLUMNNAME$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.set(columnName);
        }
    }

    /**
     * Inserts the value as the ith "column-name" element
     */
    public void insertColumnName(int i, java.lang.String columnName)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target =
                (org.apache.xmlbeans.SimpleValue)get_store().insert_element_user(COLUMNNAME$0, i);
            target.setStringValue(columnName);
        }
    }

    /**
     * Appends the value as the last "column-name" element
     */
    public void addColumnName(java.lang.String columnName)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(COLUMNNAME$0);
            target.setStringValue(columnName);
        }
    }

    /**
     * Inserts and returns a new empty value (as xml) as the ith "column-name" element
     */
    public org.apache.xmlbeans.XmlString insertNewColumnName(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().insert_element_user(COLUMNNAME$0, i);
            return target;
        }
    }

    /**
     * Appends and returns a new empty value (as xml) as the last "column-name" element
     */
    public org.apache.xmlbeans.XmlString addNewColumnName()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().add_element_user(COLUMNNAME$0);
            return target;
        }
    }

    /**
     * Removes the ith "column-name" element
     */
    public void removeColumnName(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(COLUMNNAME$0, i);
        }
    }
}
